import { getStore } from '@/utils/store'

const formConfig = {
	inline: false,
	showBtn: true,
	submitBtnText: '确定',
	backBtnText: '取消',
	labelPosition: 'top',
	labelWidth: '100px',
	column: [
		{
			label: '回执信息',
			listType: 'picture-card',
			prop: 'receiptImgs',
			type: 'upload',
			labelPosition: 'top',
			showFileList: true,
			limit:4,
			multiple: true,
			span: 24,
		},
		{
			label: '实际金额',
			prop: 'grantAmount',
			type: 'input',
			span: 24,
		},
		{
			label: '备注',
			prop: 'note',
			type: 'textarea',
			span: 24,
		},
	],
}
export const tableConfig = () => {
	const orgConfig = {
		stripe: true,
		border: true,
		maxHeight: '80vh',
		columns: [
			{
				label: '录入时间',
				prop: 'receiptDate',
			},
            // {
            //     label:'发放频率',
            //     prop:'distributionFrequency'
            // },
			{
				label: '回执信息',
				width:200,
				prop: 'receiptImgs',
                custome:"file"
			},
			{
				label: '实际金额',
				prop: 'grantAmount',
			},
			{
				label: '备注',
				prop: 'note',
			},
			{
				label: '操作',
				prop: 'menu',
				width: 120,
				fixed: 'right',
			},
		],
	}
	return orgConfig
}

export const baseConfig: any = {
	pageName: '资金回执管理',
	dictcodes: [],
	rowKey: 'id',
	tipLabel: 'receiptDate',
	addLabel: '添加',
	api: {
		add: 'view_ofsSubsidyReceipt_add',
		edit: 'view_ofsSubsidyReceipt_edit',
		delete: 'view_ofsSubsidyReceipt_del',
		index: 'view_ofsSubsidyReceipt_page',
	},
	auth: {
		add: 'view_ofsSubsidyReceipt_add',
		edit: 'view_ofsSubsidyReceipt_edit',
		delete: 'view_ofsSubsidyReceipt_del',
		index: 'view_ofsSubsidyReceipt_page',
	},
	paramsObj: {},
	dialogConfig: {
		width: '50%',
	},
	menuBtn: [
		{
			icon: 'detail',
			label: '查看',
			type: 'primary',
			operate: 'detail',
			auth: 'view_ofsSubsidyReceipt_page',
			text: true,
			show: true,
		},
		{
			icon: 'delete',
			label: '删除',
			type: 'danger',
			operate: 'delete',
			auth: 'view_ofsSubsidyReceipt_del',
			text: true,
			show: true,
		},
	],
	onLoadFormate: async (arr) => {
		const tableData = arr.map((item) => {
			item.haRreceiptImgs = item.receiptImgs ? '是' : '--'
			return {
				...item,
			}
		})
		return Promise.resolve(Object.freeze(tableData))
	},
    detailConfig:formConfig,
    formConfig,
	tableConfig: tableConfig(),
}
